package com.itheima.mapper;

import com.itheima.domain.Course;
import com.itheima.domain.Student;
import org.apache.ibatis.annotations.*;
import org.apache.ibatis.mapping.FetchType;

import java.util.List;

public interface StudentMapper {
        @Select("SELECT *  FROM student")
        @Results({
                @Result(column = "sid"  , property = "id" ,  id =true),
                @Result(column = "name"  , property = "name"),
                @Result(column = "age"  , property = "age"),
                @Result(javaType = List.class,
                        property = "courses",
                        column = "cid",
                        many=@Many(select = "com.itheima.mapper.CoureseMapper.findByCid",fetchType = FetchType.LAZY)                )
        })



        List<Student> findAll();
}
